@@ -15,6 +15,7 @@ |
||
15 | 15 |
<uses-feature android:name="android.hardware.usb.host" /> |
16 | 16 |
<uses-permission android:name="android.hardware.usb.accessory" /> |
17 | 17 |
<uses-permission android:name="android.permission.VIBRATE"/> |
18 |
+ |
|
18 | 19 |
<uses-feature android:name="android.hardware.camera" /> |
19 | 20 |
<uses-feature android:name="android.hardware.camera.autofocus" /> |
20 | 21 |
|
@@ -61,55 +62,55 @@ |
||
61 | 62 |
android:name=".session.SessionActivity" |
62 | 63 |
android:configChanges="keyboardHidden|orientation|screenSize" |
63 | 64 |
android:label="@string/app_name" |
64 |
- android:screenOrientation="portrait"></activity> |
|
65 |
+ android:screenOrientation="portrait"/> |
|
65 | 66 |
|
66 | 67 |
<activity |
67 | 68 |
android:name=".qrcode.QRCaptureActivity" |
68 | 69 |
android:configChanges="keyboardHidden|orientation|screenSize" |
69 | 70 |
android:label="@string/app_name" |
70 |
- android:screenOrientation="portrait"></activity> |
|
71 |
+ android:screenOrientation="portrait"/> |
|
71 | 72 |
|
72 | 73 |
<activity |
73 | 74 |
android:name=".briefs.BriefsActivity" |
74 | 75 |
android:configChanges="keyboardHidden|orientation|screenSize" |
75 | 76 |
android:label="@string/app_name" |
76 |
- android:screenOrientation="portrait"></activity> |
|
77 |
+ android:screenOrientation="portrait"/> |
|
77 | 78 |
|
78 | 79 |
<activity |
79 | 80 |
android:name=".settings.SettingsActivity" |
80 | 81 |
android:configChanges="keyboardHidden|orientation|screenSize" |
81 | 82 |
android:label="@string/app_name" |
82 |
- android:screenOrientation="portrait"></activity> |
|
83 |
+ android:screenOrientation="portrait"/> |
|
83 | 84 |
|
84 | 85 |
<activity |
85 | 86 |
android:name=".printer.PrinterSettingActivity" |
86 | 87 |
android:configChanges="keyboardHidden|orientation|screenSize" |
87 | 88 |
android:label="@string/app_name" |
88 |
- android:screenOrientation="portrait"></activity> |
|
89 |
+ android:screenOrientation="portrait"/> |
|
89 | 90 |
|
90 | 91 |
<activity |
91 | 92 |
android:name=".activities.AboutUsActivity" |
92 | 93 |
android:configChanges="keyboardHidden|orientation|screenSize" |
93 | 94 |
android:label="@string/app_name" |
94 |
- android:screenOrientation="portrait"></activity> |
|
95 |
+ android:screenOrientation="portrait"/> |
|
95 | 96 |
|
96 | 97 |
<activity |
97 | 98 |
android:name=".activities.FeedbackActivity" |
98 | 99 |
android:configChanges="keyboardHidden|orientation|screenSize" |
99 | 100 |
android:label="@string/app_name" |
100 |
- android:screenOrientation="portrait"></activity> |
|
101 |
+ android:screenOrientation="portrait"/> |
|
101 | 102 |
|
102 | 103 |
<activity |
103 | 104 |
android:name=".activities.PriceSettingActivity" |
104 | 105 |
android:configChanges="keyboardHidden|orientation|screenSize" |
105 | 106 |
android:label="@string/app_name" |
106 |
- android:screenOrientation="portrait"></activity> |
|
107 |
+ android:screenOrientation="portrait"/> |
|
107 | 108 |
|
108 | 109 |
<activity |
109 | 110 |
android:name=".activities.WebViewActivity" |
110 | 111 |
android:configChanges="keyboardHidden|orientation|screenSize" |
111 | 112 |
android:label="@string/app_name" |
112 |
- android:screenOrientation="portrait"></activity> |
|
113 |
+ android:screenOrientation="portrait"/> |
|
113 | 114 |
|
114 | 115 |
<activity |
115 | 116 |
android:name=".wxapi.WXEntryActivity" |
@@ -128,8 +129,7 @@ |
||
128 | 129 |
android:label="GpPrintService" |
129 | 130 |
android:process=":remote" |
130 | 131 |
android:enabled="true" |
131 |
- android:exported="true" |
|
132 |
- > |
|
132 |
+ android:exported="true"> |
|
133 | 133 |
<intent-filter> |
134 | 134 |
<action android:name="com.gprinter.aidl.GpPrintService" /> |
135 | 135 |
</intent-filter> |
@@ -31,10 +31,10 @@ import butterknife.OnClick; |
||
31 | 31 |
public class PrinterSettingActivity extends BaseActivity implements PrinterSettingContract.View,AdapterView.OnItemClickListener { |
32 | 32 |
|
33 | 33 |
@BindView(R.id.listview_bt_devices) ListView btDevicesList; |
34 |
- @BindView(R.id.tv_printer_status) TextView printerStatusText; |
|
35 |
- @BindView(R.id.tv_bluetooth_status) TextView bluetoothStatusText; |
|
36 |
- @BindView(R.id.tb_bluetooth_switch) ToggleButton btSwitchToggle; |
|
37 |
- @BindView(R.id.iv_qrcode) ImageView qrCodeImg; |
|
34 |
+ @BindView(R.id.tv_printer_status) TextView printerStatusText; |
|
35 |
+ @BindView(R.id.tv_bluetooth_status) TextView bluetoothStatusText; |
|
36 |
+ @BindView(R.id.tb_bluetooth_switch) ToggleButton btSwitchToggle; |
|
37 |
+ @BindView(R.id.iv_qrcode) ImageView qrCodeImg; |
|
38 | 38 |
|
39 | 39 |
private BluetoothDeviceListAdapter deviceAdapter; |
40 | 40 |
private PrinterSettingContract.Presenter presenter; |
@@ -54,17 +54,12 @@ public class PrinterSettingActivity extends BaseActivity implements PrinterSetti |
||
54 | 54 |
finish(); |
55 | 55 |
return; |
56 | 56 |
} |
57 |
- qrCodeImg.post(new Runnable() { |
|
58 |
- @Override |
|
59 |
- public void run() { |
|
60 |
- try{ |
|
61 |
- qrCodeImg.setImageBitmap(QRCreateUtils.Create2DCode("http://pai.ai/s/"+qrcode, |
|
62 |
- DeviceUtils.dip2px(PrinterSettingActivity.this,240))); |
|
63 |
- }catch (Exception e){ |
|
64 |
- e.printStackTrace(); |
|
65 |
- } |
|
66 |
- } |
|
67 |
- }); |
|
57 |
+ try{ |
|
58 |
+ qrCodeImg.setImageBitmap(QRCreateUtils.Create2DCode("http://pai.ai/s/"+qrcode, |
|
59 |
+ DeviceUtils.dip2px(this,240))); |
|
60 |
+ }catch (Exception e){ |
|
61 |
+ e.printStackTrace(); |
|
62 |
+ } |
|
68 | 63 |
|
69 | 64 |
deviceAdapter = new BluetoothDeviceListAdapter(this); |
70 | 65 |
btDevicesList.setAdapter(deviceAdapter); |
@@ -142,10 +137,8 @@ public class PrinterSettingActivity extends BaseActivity implements PrinterSetti |
||
142 | 137 |
@OnCheckedChanged(R.id.tb_bluetooth_switch) |
143 | 138 |
void switchBluetooth(){ |
144 | 139 |
if(!presenter.queryBluetoothStatus()){ |
145 |
- Intent enableIntent = new Intent( |
|
146 |
- BluetoothAdapter.ACTION_REQUEST_ENABLE); |
|
147 |
- startActivityForResult(enableIntent, |
|
148 |
- REQUEST_ENABLE_BT); |
|
140 |
+ Intent enableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); |
|
141 |
+ startActivityForResult(enableIntent, REQUEST_ENABLE_BT); |
|
149 | 142 |
}else{ |
150 | 143 |
BluetoothAdapter.getDefaultAdapter().disable(); |
151 | 144 |
onBluetoothDisabled(); |
@@ -171,4 +164,5 @@ public class PrinterSettingActivity extends BaseActivity implements PrinterSetti |
||
171 | 164 |
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { |
172 | 165 |
presenter.connectPrinter(deviceAdapter.getDeviceList().get(i)); |
173 | 166 |
} |
167 |
+ |
|
174 | 168 |
} |
@@ -42,16 +42,18 @@ public class PrinterSettingPresenter implements PrinterSettingContract.Presenter |
||
42 | 42 |
private GpService mGpService; |
43 | 43 |
private PrinterServiceConnection conn = null; |
44 | 44 |
|
45 |
+ private static final String TAG = "PrinterSettingPresenter"; |
|
46 |
+ |
|
45 | 47 |
class PrinterServiceConnection implements ServiceConnection { |
46 | 48 |
@Override |
47 | 49 |
public void onServiceDisconnected(ComponentName name) { |
48 |
- Log.i("czy111", "onServiceDisconnected() called"); |
|
50 |
+ Log.i(TAG, "onServiceDisconnected() called"); |
|
49 | 51 |
mGpService = null; |
50 | 52 |
} |
51 | 53 |
|
52 | 54 |
@Override |
53 | 55 |
public void onServiceConnected(ComponentName name, IBinder service) { |
54 |
- Log.i("czy111", "onServiceConnected() called"); |
|
56 |
+ Log.i(TAG, "onServiceConnected() called"); |
|
55 | 57 |
mGpService = GpService.Stub.asInterface(service); |
56 | 58 |
} |
57 | 59 |
} |
@@ -128,7 +130,8 @@ public class PrinterSettingPresenter implements PrinterSettingContract.Presenter |
||
128 | 130 |
} |
129 | 131 |
EscCommand esc = new EscCommand(); |
130 | 132 |
/*打印文字*/ |
131 |
- esc.addSelectPrintModes(EscCommand.FONT.FONTA, EscCommand.ENABLE.OFF, EscCommand.ENABLE.OFF, EscCommand.ENABLE.OFF, EscCommand.ENABLE.OFF);//取消倍高倍宽 |
|
133 |
+ esc.addSelectPrintModes(EscCommand.FONT.FONTA, EscCommand.ENABLE.OFF, EscCommand.ENABLE.OFF, |
|
134 |
+ EscCommand.ENABLE.OFF, EscCommand.ENABLE.OFF);//取消倍高倍宽 |
|
132 | 135 |
esc.addSelectJustification(EscCommand.JUSTIFICATION.CENTER);//设置打印左对齐 |
133 | 136 |
esc.addText("拍爱\n"); // 打印文字 |
134 | 137 |
esc.addPrintAndLineFeed(); |
@@ -203,7 +206,7 @@ public class PrinterSettingPresenter implements PrinterSettingContract.Presenter |
||
203 | 206 |
if(code==0){ |
204 | 207 |
Preferences.getInstance().setPrinterMac(device.getAddress()); |
205 | 208 |
} |
206 |
- LogHelper.d("czy111","open port return code ="+code); |
|
209 |
+ LogHelper.d(TAG,"open port return code ="+code); |
|
207 | 210 |
} catch (Exception e) { |
208 | 211 |
view.showToast(context.getString(R.string.printer_port_open_fail)); |
209 | 212 |
} |
@@ -262,7 +265,7 @@ public class PrinterSettingPresenter implements PrinterSettingContract.Presenter |
||
262 | 265 |
if (GpCom.ACTION_CONNECT_STATUS.equals(intent.getAction())) { |
263 | 266 |
int type = intent.getIntExtra(GpPrintService.CONNECT_STATUS, 0); |
264 | 267 |
int id = intent.getIntExtra(GpPrintService.PRINTER_ID, 0); |
265 |
- Log.d("czy111", "connect status " + type); |
|
268 |
+ Log.d(TAG, "connect status " + type); |
|
266 | 269 |
if (type == GpDevice.STATE_CONNECTING) { |
267 | 270 |
view.onPrinterStatusFetched(context.getString(R.string.connecting)); |
268 | 271 |
} else if (type == GpDevice.STATE_NONE) { |